﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Data.Entity.Infrastructure;
namespace CMSDB
{
    public class DBManager : DbContext
    {
        private readonly static string CONNECTION_STRING = "name=ContentString";
        public DbSet<CMSModel.Advertisement> Advertisement { get; set; }
        public DbSet<CMSModel.Announcement> Announcement { get; set; }
        public DbSet<CMSModel.Category> Category { get; set; }
        public DbSet<CMSModel.CustomerService> CustomerService { get; set; }
        public DbSet<CMSModel.FriendLink> FriendLink { get; set; }
        public DbSet<CMSModel.Message> Message { get; set; }
        public DbSet<CMSModel.Option> Option { get; set; }
        public DbSet<CMSModel.PicDoc> PicDoc { get; set; }
        public DbSet<CMSModel.RollingPictures> RollingPictures { get; set; }
        public DbSet<CMSModel.SiteInfo> SiteInfo { get; set; }
        public DbSet<CMSModel.SpecialSubject> SpecialSubject { get; set; }
        public DbSet<CMSModel.UserFeedback> UserFeedback { get; set; }
        public DbSet<CMSModel.UserOpposition> UserOpposition { get; set; }
        public DbSet<CMSModel.UserRead> UserRead { get; set; }
        public DbSet<CMSModel.UserRecommend> UserRecommend { get; set; }
        public DbSet<CMSModel.UserReply> UserReply { get; set; }
        public DbSet<CMSModel.UserShare> UserShare { get; set; }
        public DbSet<CMSModel.Voting> Voting { get; set; }
        public DbSet<CMSModel.Doc> Doc { get; set; }
        public DbSet<CMSModel.User> User { get; set; }

        public DBManager() : base(CONNECTION_STRING) { }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();//移除复数表名的契约          
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();//防止黑幕交易 要不然每次都要访问 EdmMetadata这个表
        }
    }
}